﻿/* ***********************************************
 * Author		:  kingthy
 * Email		:  kingthy@gmail.com
 * Description	:  TimelineData
 *
 * ***********************************************/

using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;

namespace OpenTwitter.SDK.Sina.Objects
{
    /// <summary>
    /// 时间线，话题返回的灵气
    /// </summary>
    public class TimelineData : ResponseData
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="xml"></param>
        internal TimelineData(XmlNode xml)
            : base(xml)
        { }

        /// <summary>
        /// 微博列表
        /// </summary>
        public Tweet[] Tweets { get; private set; }
        /// <summary>
        /// 解析XML文档数据
        /// </summary>
        protected override void Parse()
        {
            base.Parse();
            List<Tweet> tweets = new List<Tweet>();
            var nodes = this.Xml.SelectNodes("status");
            foreach (XmlNode n in nodes)
            {
                tweets.Add(new Tweet(n));
            }
            this.Tweets = tweets.ToArray();
        }
    }
}
